package com.rs.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 车辆角度(用于计算行进方向)
 *
 * @author zhouwz
 * @date 2020/9/13 18:31
 */
@AllArgsConstructor
public enum VehicleAngle {
    /**
     * 车辆角度
     */
    UP(90, "上"),
    DOWN(-90, "下"),
    LEFT(180, "左"),
    RIGHT(0, "右"),
    ERROR(-1, "无该角度"),
    ;
    @Getter
    private final Integer code;
    @Getter
    private final String msg;

    public static VehicleAngle getVehicleAngle(Integer code) {
        for (VehicleAngle item : VehicleAngle.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return ERROR;
    }
}
